package com.ruoyi.zhjd.collect.modules.piece.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.zhjd.collect.modules.piece.dto.CollectPieceDto;
import com.ruoyi.zhjd.collect.modules.piece.dto.PieceAndDosageDto;
import com.ruoyi.zhjd.collect.modules.piece.dto.StatisticsPieceDto;
import com.ruoyi.zhjd.collect.modules.piece.service.LCollectPieceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 盘信息
 */
@RestController
@RequestMapping("/collect/piece")
public class LCollectPieceController {

    @Autowired
    private LCollectPieceService LCollectPieceService;

    /**
     * 分页
     *
     * @param params 查询条件
     * @return Result 分页列表
     */
    @GetMapping("page")
    public R<IPage<CollectPieceDto>> page(@RequestParam Map<String, Object> params) {
        IPage<CollectPieceDto> page = LCollectPieceService.page(params);
        return R.ok(page);
    }

    @GetMapping("list")
    public R<List<CollectPieceDto>> list(@RequestParam Map<String, Object> params) {
        List<CollectPieceDto> list = LCollectPieceService.list(params);
        return R.ok(list);
    }

    /**
     * 盘数据统计
     *
     * @param params 查询条件
     */
    @GetMapping("statisticsPiece")
    public R<IPage<StatisticsPieceDto>> statisticsPiece(@RequestParam Map<String, Object> params) {
        IPage<StatisticsPieceDto> page = LCollectPieceService.statisticsPiece(params);
        return R.ok(page);
    }

    /**
     * 盘数据统计
     *
     * @param params 查询条件
     */
    @GetMapping("pagePieceAndDosage")
    public R<IPage<PieceAndDosageDto>> pagePieceAndDosage(@RequestParam Map<String, Object> params) {
        IPage<PieceAndDosageDto> page = LCollectPieceService.pagePieceAndDosage(params);
        return R.ok(page);
    }
}
